package com.yjhh.tilemap.utils;

import java.io.File;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Description:文件操作工具类
 *
 * @JDK Version:1.8.0_40
 * Version: V1.0
 * Author: spring
 * Date: 2017/8/22
 */

public class FileTools {

    public static void sortByFileName(List<File> fileListTemp) {
        Collections.sort(fileListTemp, new Comparator<File>() {
            @Override
            public int compare(File o1, File o2) {
                if (o1.isDirectory() && o2.isFile())
                    return -1;
                if (o1.isFile() && o2.isDirectory())
                    return 1;
                return o1.getName().compareTo(o2.getName());
            }
        });
    }

}
